import { changeStatus, edit } from "@/utils/form";
import { ngTypeRemoveInId, ngTypeChangeStatusById } from "@/api/useDataGrid";

// 表格组件 传参
export default {
  data() {
    return {

      dataGrid: {
        visible: false,
        loading: false,
        columns: [
          {
            label: "产品类型",
            prop: "modelType",
            align: "center"
          },
          {
            label: "不良类型",
            prop: "type",
            align: "center"
          },
          {
            label: "不良类型名称",
            prop: "name",
            align: "center"
          },
          {
            label: "状态",
            prop: "statusName",
            align: "center"
          },
          {
            label: "备注",
            prop: "remark",
            align: "center"
          },
          {
            label: "操作",
            align: "center",
            width: 220,
            action: true
          }
        ],
        data: [],
        btnList: [
          {
            label: "编辑",
            mthods: (row) => edit("formProperty", this, this.addFormApi, row),
            // icon: "el-icon-delete",
            type: "text"
          },
          {
            label: "删除",
            mthods: (row) => changeStatus(row, ngTypeRemoveInId, "确定删除?", this.searchForm.refresh),
            // icon: "el-icon-delete",
            style: {
              color: "#F56C6C"
            },
            type: "text"
          },
          {
            label: "禁用",
            hide: (row) => row.status !== 0,
            mthods: (row) => changeStatus(row, ngTypeChangeStatusById, "确定禁用?", this.searchForm.refresh, 1),
            style: {
              color: "#F56C6C"
            },
            type: "text"
          },
          {
            label: "启用",
            hide: (row) => row.status !== 1,
            mthods: (row) => changeStatus(row, ngTypeChangeStatusById, "确定启用?", this.searchForm.refresh, 0),
            type: "text"
          }
        ],
        pagination: {
          hidden: 2,
          pageNum: 1,
          pageSizes: [50, 100, 150],
          pageSize: 50,
          total: 0,
          pageCount: 0
        }
      }
    };
  },
  methods: {

  }
};
